package com.xc.hotelmgr.datapusherali.controller;
import com.xc.hotelmgr.datapusherali.pojo.mybatis.HtPhysicalRoom;
import com.xc.hotelmgr.datapusherali.service.mybatis.HtPhysicalRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/physical_room")
public class FzPhysicalRoomController {

    @Autowired
    private HtPhysicalRoomService htPhysicalRoomService;

    //房型多种状态更新，并且更新数据库
    @RequestMapping(value = "/update_room", method = RequestMethod.POST)
    public String updateRoom(@RequestBody HtPhysicalRoom htPhysicalRoom) {

//        int result = htPhysicalRoomService.updateExceptNull(htPhysicalRoom);
//        if (result > 0) {
//
//            String resultPush = pushService.roomUpdate(htPhysicalRoom);
//            if(resultPush.contains("xhotel_roomtype_update_response")){
//                return "房型更新,推送成功";
//            }
//            return "房型更新成功，推送失败";
//        }
        return "房型数据库存储失败";
    }


    //房型多种状态推送，不更新数据库
    @RequestMapping(value = "/send_room", method = RequestMethod.POST)
    public String SendRoom(@RequestBody HtPhysicalRoom htPhysicalRoom) {
//        String resultPush = pushService.roomSend(htPhysicalRoom);
//        System.out.println(resultPush);
//        if(resultPush.contains("xhotel_roomtype_add_response")){
//            return "房型推送成功";
//        }
        return "房型推送失败";
    }

    //删除房型接口
    @RequestMapping(value = "/del_room",method = RequestMethod.POST)
    public String delRoom(@RequestBody HtPhysicalRoom htPhysicalRoom){

//        String resultPush = pushService.roomDel(htPhysicalRoom);
//        if(resultPush.contains("xhotel_roomtype_delete_public_response")){
//            return "房型删除成功";
//        }
        return "房型删除失败";
    }
    
}